package utils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.assertj.core.util.Lists;

import com.alibaba.fastjson.JSON;
import com.bo.wei.chen.mybatis.model.MicroCreditRiskDto;
import com.bo.wei.chen.mybatis.model.MicroCreditRiskLevelDto;
import com.bo.wei.chen.mybatis.model.MicroCreditRiskRuleDto;
import com.bo.wei.chen.mybatis.model.MicroCreditRiskScoreDto;
import com.bo.wei.chen.mybatis.model.MicroRiskWarnExternalRespDto;

/**
 * TODO
 *
 * @author chenwb25485
 * @version V2.1
 * @since 2020/11/6 15:36
 */
public class warn {
    public static void main(String[] args) {
        Map<String, Object> mockRiskResponse = new HashMap<>();
        // 风险等级
        List<MicroCreditRiskLevelDto> riskLevelList = Lists.newArrayList();
        List<MicroCreditRiskRuleDto> ruleList = Lists.newArrayList();
        List<MicroCreditRiskRuleDto> ruleList1 = Lists.newArrayList();
        MicroCreditRiskRuleDto ruleDto = MicroCreditRiskRuleDto.builder()
            .ruleKey("高")
            .ruleValue("1、客户当前申请所用ip近72小时关联的申请用户数>=5;")
            .build();
        MicroCreditRiskRuleDto ruleDto1 = MicroCreditRiskRuleDto.builder()
            .ruleKey("高")
            .ruleValue("1、客户近24个月逾期次数5次；")
            .build();
        MicroCreditRiskRuleDto ruleDto2 = MicroCreditRiskRuleDto.builder()
            .ruleKey("高")
            .ruleValue("2、客户近24个月逾期总金额12006.00元；")
            .build();
        MicroCreditRiskRuleDto ruleDto3 = MicroCreditRiskRuleDto.builder()
            .ruleKey("高")
            .ruleValue("3、客户近6个月贷款申请征信查询次数6次；")
            .build();
        ruleList.add(ruleDto);
        ruleList1.add(ruleDto1);
        ruleList1.add(ruleDto2);
        ruleList1.add(ruleDto3);
        String riskItemId = "123";
        MicroCreditRiskLevelDto microCreditRiskLevelDto = MicroCreditRiskLevelDto.builder()
            .riskItemId("fraudRiskLevel")
            .riskItemName("欺诈风险等级")
            .riskLevelValue("中")
            .ruleList(ruleList)
            .build();
        MicroCreditRiskLevelDto microCreditRiskLevelDto2 = MicroCreditRiskLevelDto.builder()
            .riskItemId("creditRiskLevel")
            .riskItemName("信用风险等级")
            .riskLevelValue("高")
            .ruleList(ruleList1)
            .build();
        riskLevelList.add(microCreditRiskLevelDto);
        riskLevelList.add(microCreditRiskLevelDto2);


        List<MicroCreditRiskScoreDto> riskScoreList = Lists.newArrayList();
        MicroCreditRiskScoreDto microCreditRiskScoreDto = MicroCreditRiskScoreDto.builder()
            .itemId("1237")
            .itemName("基本信息")
            .itemScore("65")
            .itemTotal("100")
            .build();
        MicroCreditRiskScoreDto microCreditRiskScoreDto1 = MicroCreditRiskScoreDto.builder()
            .itemId("1236")
            .itemName("还款能力")
            .itemScore("60")
            .itemTotal("100")
            .build();
        MicroCreditRiskScoreDto microCreditRiskScoreDto2 = MicroCreditRiskScoreDto.builder()
            .itemId("1235")
            .itemName("还款意愿")
            .itemScore("40")
            .itemTotal("100")
            .build();
        MicroCreditRiskScoreDto microCreditRiskScoreDto3 = MicroCreditRiskScoreDto.builder()
            .itemId("1234")
            .itemName("征信状况")
            .itemScore("50")
            .itemTotal("100")
            .build();
        MicroCreditRiskScoreDto microCreditRiskScoreDto4 = MicroCreditRiskScoreDto.builder()
            .itemId("1233")
            .itemName("稳定性")
            .itemScore("60")
            .itemTotal("100")
            .build();
        riskScoreList.add(microCreditRiskScoreDto);
        riskScoreList.add(microCreditRiskScoreDto1);
        riskScoreList.add(microCreditRiskScoreDto2);
        riskScoreList.add(microCreditRiskScoreDto3);
        riskScoreList.add(microCreditRiskScoreDto4);
        MicroCreditRiskDto microCreditRiskDto = MicroCreditRiskDto.builder()
            .riskLevelList(riskLevelList)
            .riskScoreList(riskScoreList)
            .build();
        mockRiskResponse.put("microCreditRiskDto", microCreditRiskDto);
        MicroRiskWarnExternalRespDto mrweResponseDto = MicroRiskWarnExternalRespDto.builder()
            .riskResponse(mockRiskResponse)
            .applyResult("A")
            .build();
        // 模拟结果
        MicroCreditRiskDto microCreditRiskDto1 = (MicroCreditRiskDto)mrweResponseDto.getRiskResponse()
            .get("microCreditRiskDto");
        String s = JSON.toJSONString(microCreditRiskDto1);
        System.out.println(s);
    }
}
